import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState   from 'vuex-persistedstate' //解决Vuex持久化插件-在F5刷新页面后数据不见的问题

Vue.use(Vuex)

const store = new Vuex.Store({
	state:{  
		//token
		token           : null,
		footerShow      : true,
		temporary_input :'',
		 
	},
	getters:{
		token           : state => state.token, 
		footerShow      : state => state.footerShow, 
		temporary_input : state => state.temporary_input, 
	},
	mutations : {
		
		settoken(state,data){
			state.token = data
		},
		setfooterShow(state,data){
			state.footerShow = data
		},
		settemporary_input(state,data){
			state.temporary_input = data
		},
	},
	actions:{

	},
	plugins: [createPersistedState({
		//默认存储到localStorage
		//想要存储到sessionStorage，配置如下
		storage: window.sessionStorage
	})]
})

export default store